<%@ page language="java" isELIgnored="false"%>
<%@include file="../common/taglib.jsp"%>

<div id="Conteudo">
	<html:form action="pergunta">
		<html:hidden property="codigo"></html:hidden>
		<html:hidden property="method"></html:hidden>
		<html:hidden property="state"></html:hidden>
		<h1><bean:message key="pergunta.label.descricao"/>:<span><bean:message key="subtitulo.label.cadastro"/></span> </h1>
		
		<div class="campo">
			<label>
				<bean:message key="pergunta.label.descricao"/><span>*</span>
			</label> 
			<html:text property="descricao" style="width:500px;" maxlength="100"></html:text>
		</div>	
		<br clear="all"/>		
		<div class="campo">
			<label>
				<bean:message key="variavel.label.descricao"/><span>*</span>
			</label> 
			<html:select property="variavel.codigo">
				<trex:options source="br.com.ia.business.VariavelBusiness.retrieveAll()" property="codigo" labelProperty="descricao"/>
			</html:select>
		</div>					
		
	</html:form>
	
	<%-- <facility-tags:error/>	--%>
	
</div>
<script>
	
	function cancelar(){
		
		document.PerguntaForm.method.value = 'prepareSearch';
		document.PerguntaForm.submit();		
	}
	
	function salvar(){
		
		var estado = document.PerguntaForm.state.value;
		
		if (estado == 'insert'){
			document.PerguntaForm.method.value = 'insert';
		}
		else if (estado == 'update'){
			document.PerguntaForm.method.value = 'update';
		}
				
		document.PerguntaForm.submit();		
	}
	
</script>